package com.softtown.modules.organization.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.softtown.common.service.impl.BaseServiceImpl;
import com.softtown.modules.organization.dao.CompOrgHstDeptDao;
import com.softtown.modules.organization.dto.CompOrgHstDeptDTO;
import com.softtown.modules.organization.entity.CompOrgHstDeptEntity;
import com.softtown.modules.organization.service.CompOrgHstDeptService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @version v1.0
 * @ProjectName: softtown-aioffice
 * @ClassName: CompOrgHstDeptServiceImpl
 * @Description: 公司部门变更履历Service实现层
 * @Author: fuming
 * @Date: 2019/6/21 22:39
 */
@Service
public class CompOrgHstDeptServiceImpl extends BaseServiceImpl<CompOrgHstDeptDao, CompOrgHstDeptEntity> implements CompOrgHstDeptService {

    /**
     * 部门履历分页
     * @param compOrgHstDeptDTO
     * @return com.github.pagehelper.PageInfo<com.softtown.modules.organization.entity.CompOrgHstDeptEntity>
     * @Author fuming
     * @Date 2020/5/26 17:00
     */
    @Override
    public PageInfo<CompOrgHstDeptEntity> getDeptHstListByCompId(CompOrgHstDeptDTO compOrgHstDeptDTO) {
        Integer pageSize = compOrgHstDeptDTO.getPageSize();
        Integer page = compOrgHstDeptDTO.getPage();
        if (pageSize > 0 && page > 0) {
            PageHelper.startPage(page, pageSize);
        }
        List<CompOrgHstDeptEntity> deptHstListByCompId = baseDao.getDeptHstListByCompId(compOrgHstDeptDTO.getCompId());
        return new PageInfo<>(deptHstListByCompId);
    }
}
